﻿using System;
using System.Collections.Generic;
using System.Text;
using Possan.Localization;
using System.Globalization;
using System.Threading;

namespace TestApp.App
{
	class Program
	{
		static void Main(string[] args)
		{
			MyLib.Test t = new MyLib.Test();

			// Possan.Localization..I18N.Initialize();

			XmlLibraryProvider lib = new XmlLibraryProvider();
			lib.ImportXML("Translation.xml");

			Possan.Localization.Translate.Library = lib;
			// Possan.Localization.Translate.Load("Translation.xml");

			Console.WriteLine(lib.PhraseCount + " phrases loaded in " + lib.LocaleCount + " locales.");

			Console.WriteLine("Using default system locale (" + CultureInfo.CurrentUICulture.Name + ")\n");

			Console.WriteLine(Possan.Localization.Translate.Phrase(typeof(Program), "Hello world!"));
			Console.WriteLine(Translate.Phrase(typeof(Program), "Hello world!"));
			t.HelloWorld1();
			t.HelloWorld2();
			t.HelloWorld3();

			Console.WriteLine("Using english.\n");

			Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-GB");

			Console.WriteLine(Possan.Localization.Translate.Phrase(typeof(Program), "Hello world!"));
			Console.WriteLine(Translate.Phrase(typeof(Program), "Hello world!"));
			t.HelloWorld1();
			t.HelloWorld2();
			t.HelloWorld3();

			Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR");

			Console.WriteLine("Using french.\n");

			Console.WriteLine(Possan.Localization.Translate.Phrase(typeof(Program), "Hello world!"));
			Console.WriteLine(Translate.Phrase(typeof(Program), "Hello world!"));
			t.HelloWorld1();
			t.HelloWorld2();
			t.HelloWorld3();

			Thread.CurrentThread.CurrentUICulture = new CultureInfo("sv-SE");

			Console.WriteLine("Using swedish.\n");

			Console.WriteLine(Possan.Localization.Translate.Phrase(typeof(Program), "Hello world!"));
			Console.WriteLine(Translate.Phrase(typeof(Program), "Hello world!"));
			t.HelloWorld1();
			t.HelloWorld2();
			t.HelloWorld3();
		}
	}
}
